import request from "@/request";
import type { responseType } from "./interface";

/**
 * 保存文件
 * @param {string} data
 * @returns
 */
export function insertFile(data: any): Promise<responseType> {
  return request.post(`/fileEntity/insert`, data);
}

/**
 * 上传
 * @returns
 */
export function uploadFile(file: any): Promise<responseType> {
  return request.post(`/uploadToOss`, file);
}

/**
 * 列表-分页
 * @param {string} page
 * @param {string} pageSize
 * @param {string} acc
 * @returns
 */
export function listPageFile(
  page: number,
  pageSize: number,
  acc?: string
): Promise<responseType> {
  return request.post(
    `/fileEntity/listPage?page=${page}&pageSize=${pageSize}&acc=${acc}`
  );
}

/**
 * 删除
 * @param {string} param
 * @returns
 */
export function deleteFile(param: string): Promise<responseType> {
  return request.post(`/fileEntity/delete/${param}`);
}
